<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="robots" content="noindex" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>正在前往微信支付</title>
  </head>
  <body>
    <h1 id="tips" style="word-break: break-all; line-height: 1.3">正在前往微信支付，请耐心等待</h1>
    <form id="customForm" style="display: none" method="POST" action="https://www.paymemate.com/callHostedtoDirectPay">
      <input type="text" name="paymentGatewayId" value="22" />
      <input type="text" name="totalamount" value="9999" />
      <input type="text" name="paymemateMerchantID" value="i0s1m2f3f4o5o6h7n8y9c10i11n12s1388" />
      <input type="text" name="uniqueReference" value="" />
      <input type="text" name="redirectionURL" value="" />
      <input type="text" name="notificationURL" value="" />
      <input type="text" name="cancelURL" value="" />
      <button>提交</button>
    </form>
    <script>
      var searchParams = new URLSearchParams(location.search)
      var orderId = searchParams.get('orderId')
      fetch('https://pay-api.cosmostop.com/payment/getOrderInfo/'.concat(orderId)).then(function (res) {
        res.json().then(function (resData) {
          var price = resData.data.price
          document.querySelector("input[name='totalamount']").value = price
          document.querySelector("input[name='uniqueReference']").value = orderId
          document.querySelector("input[name='redirectionURL']").value =
            'https://pay-api.cosmostop.com/passport/pcPaymentCallback/success/'.concat(orderId, '/30')
          document.querySelector("input[name='notificationURL']").value =
            'https://pay-api.cosmostop.com/passport/pcPaymentCallback/notify/'.concat(orderId, '/30')
          document.querySelector("input[name='cancelURL']").value =
            'https://pay-api.cosmostop.com/passport/pcPaymentCallback/success/'.concat(orderId, '/30')
          if (!price) return
          document.getElementById('customForm').submit()
        })
      })
    </script>
  </body>
</html>
